<?php
// 循环接收表单内容
foreach ($_POST as $key => $value){
    if ($key != '提交'){
        $$key = $value;
    }
}
// 把数组爱好拆分为字符串
$hobby = implode(',',$hobby);
// 连接数据库
include_once ('conn.php');
// 执行添加sql
$sql = "insert into `user` value ('$username','$password1','$sex',$height,'$phone','$hobby',$age,'$address','$aboutme','$photo')";
// 执行上面的SQL语句
$result = mysqli_query($conn,$sql);
// 判断
if($result){
    echo "注册成功。<a href='login.php'>请登录！</a>";
}else{
    die("注册失败。".mysqli_error($conn));
}